package com.ailargemodel.utils;// Copyright (c) Alibaba, Inc. and its affiliates.

import java.util.Arrays;

import com.ailargemodel.common.RedisLimiterManager;
import com.ailargemodel.pojo.User;
import com.ailargemodel.service.UserService;
import com.alibaba.dashscope.aigc.generation.Generation;
import com.alibaba.dashscope.aigc.generation.GenerationResult;
import com.alibaba.dashscope.aigc.generation.models.QwenParam;
import com.alibaba.dashscope.common.Message;
import com.alibaba.dashscope.common.Role;
import com.alibaba.dashscope.exception.ApiException;
import com.alibaba.dashscope.exception.InputRequiredException;
import com.alibaba.dashscope.exception.NoApiKeyException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;




@Component
@Slf4j
public class AIUtils {
    @Autowired
    private OllamaChatModel ollamaChatModel;

    @Autowired
    private static  UserService userService;
    public  String callWithMessage(String context)
            throws NoApiKeyException, ApiException, InputRequiredException {


        return ollamaChatModel.call(context);
    }

    @Autowired(required=false)
    public String callOllamaWithMessage(String message) {
        String prompt = "西南科技大學相關信息";
        String result = ollamaChatModel.call(prompt + ":" + message);
        return result;
    }

}
